package 笔试.A2022美团;

import java.util.Scanner;

public class first {
    public static void main(String arg[]){
         Scanner scanner=new Scanner(System.in);
         int n=scanner.nextInt();
         int[] data=new int[n];
        for (int i = 0; i < n; i++) {
            data[i]=scanner.nextInt();
        }
        //最小前缀和加双指针
        int res=0;
        int middle[]=new int[n+1];
        for (int i = 0; i < n; i++) {
            middle[i+1]=middle[i]+(data[i]==-1?1:0);
//            res+=data[i]==1?1:0;
        }

        for (int i = 0; i < middle.length-1; i++) {
            for (int j = i+1; j < middle.length; j++) {
                if ((middle[j]-middle[i])%2==0)
                    res++;
            }
        }
        System.out.println(res);

    }
}
